import 'package:animal/network/api.dart';
import 'package:animal/socket/type_model.dart';
import 'package:animal/ui/friend/NWApi.dart';
import 'package:animal/ui/friend/model/friend_model.dart';
import 'package:animal/ui/friend/model/search_user_model.dart';
import 'package:animal/ui/message/page/message_detaile_page.dart';
import 'package:animal/utils/sputils/sp_config.dart';
import 'package:animal/utils/sputils/sp_utils.dart';
import 'package:animal/utils/string_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class FriendInfoController extends GetxController{

  UserModel? userModel;

  RxString dropdownValue = "".obs;

  final map = {
    "关于": Icons.info_outline,
    "帮助": Icons.help_outline,
    "问题反馈": Icons.add_comment,
  };

  ///发送好友申请
  void sendFriend(){
    //:group,qr,businessCar,search,accountSearch,mobileSearch,market
    var putData = {
      "addType":"mobileSearch",
      "uid":"${userModel!.uid}",
      "source":"",
      "sign":StringUtils().generateMD5("${userModel!.uid}${userModel!.friendAddType}${SpConfig().getUserId()}"),
      "context":"这是一个好朋友",
      "friendRemark":"",
    };
    debugPrint("${userModel!.uid}${userModel!.friendAddType}${SpConfig().getUserId()}");
    HttpManager().post(ChatApi.friendApply,queryParameters: putData).listen((value) { },onError: (err){
      debugPrint(err.message);
    });
  }

  ///前往发送消息
  void gotoMessageDetail(){
    Get.to(MessageDetailPage(friendModel: userModel!,));
  }
}